package com.ncamc.pms.core.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ncamc.pms.core.entity.ParamKettleTransFile;
import com.ncamc.pms.core.mapper.ParamKettleTransFileMapper;
import com.ncamc.pms.core.service.ParamKettleTransFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ParamKettleTransFileServiceImpl extends ServiceImpl<ParamKettleTransFileMapper, ParamKettleTransFile> implements ParamKettleTransFileService {

    @Autowired
    private ParamKettleTransFileMapper mapper;

    @Override
    public void updateLastTime(String kettleCode, String lastTime) {
        if (StrUtil.isBlank(kettleCode) || StrUtil.isBlank(lastTime)) {
            return;
        }
        lambdaUpdate().set(ParamKettleTransFile::getLastTime, lastTime)
                .eq(ParamKettleTransFile::getKettleCode, kettleCode)
                .update();
    }

    @Override
    public ParamKettleTransFile getKettleTransFile(String kettleCode) {
        return lambdaQuery().eq(ParamKettleTransFile::getKettleCode, kettleCode).one();
    }
}
